CFLAGS?=	-Wall -ggdb -W -O
LDFLAGS?=

CC?=		gcc
LDLIBS?= -lpthread -lpq
INCLUDE = -I./include -I /usr/include/postgresql

TEMPFILES?=
 
src = $(wildcard *.c)        
objs = $(patsubst %.c,%.o,$(src))
 
VERSION=1.0
TMPDIR=/tmp/socket-$(VERSION)


SOURCES = $(wildcard *.c)
OBJS = $(patsubst %.c,%.o,$(SOURCES))
 

SOCKET= server client  test
all:	$(SOCKET) 

objects = server.o psql_operation.o shm_operation.o

server: $(objects)
	$(CC) $(CFLAGS) $(objects)  -o server $(LDLIBS) $(INCLUDE)

test:test.o shm_operation.o psql_operation.o

%.o:%.c 
	$(CC) $(CFLAGS) $(LDFLAGS) -c $< -o $@   $(LDLIBS) $(INCLUDE)


clean:
	rm -f $(SOCKET)  $(TEMPFILES) *.o 

.PHONY: clean install all tar


 
